package win;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Main {
    public static void main(String[] args) {
        //1.创建一个窗口
        JFrame win = new JFrame("晚上打王者不");
        //2.创建一个按钮对象
        JButton btn1 = new JButton("带飞你OwO");
        JButton btn2 = new JButton("不想掉段QAQ");
        JPanel jPanel1 = new JPanel();
        JPanel jPanel2 = new JPanel();
        btn1.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JOptionPane.showMessageDialog(win,"好耶");
            }
        });
        btn2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JOptionPane.showMessageDialog(win,"好叭，只好单排了");
            }
        });
        //3.把按钮添加到窗口上
        win.add(jPanel1);
        jPanel1.add(btn1);
        jPanel1.add(btn2);
        //4.展示窗口
        win.setSize(400,300);
        win.setLocationRelativeTo(null);
        win.setVisible(true);
    }
}
